#pragma once

#include "cocos2d.h"
#include "Common/DbHelper.h"
#include "CommonGame/GlobalDataBase.h"

USING_NS_CC;

struct TNpcData;
struct TEquipmentData;
struct TLevelData;

class GlobalData : public GlobalDataBase
{
public:
	static GlobalData* getInstance();

	const TNpcData* getNpcData(const std::string& key);
	const TEquipmentData* getEquipmentData(int id);
	const TLevelData* getLevelData(int id);

protected:
	GlobalData();
	virtual ~GlobalData();

	virtual bool doInitialize() override;
	virtual void doDestory() override;

	bool initNpcData();
	bool initEquipmentData();
	bool initLevelData();

private:
	static GlobalData* m_pInstance;

	std::vector<TNpcData*>        m_npcDataArray;
	std::vector<TEquipmentData*>  m_equipmentDataArray;
	std::vector<TLevelData*>      m_levelDataArray;
};
